import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    count: 0,
    num: 2
  },
  mutations: {
    increment(state) {
      state.count++;
    },
    decrement(state) {
      state.count--;
    },
    // 第二个参数就是传过来的参数 是一个对象
    incrementN(state, payload) {
      state.count += payload.n;
    },
  },
  actions: {},
  getters: {}
});